/* const express = require('express')
const router = express.Router()

let mw1 = (req,res,next)=>{
    console.log('midware1')
    next()
}

let mw2 = (req,res,next)=>{
    console.log('midware2')
    next()
}

router.get('/home',[mw1,mw2],(req,res)=>{
    console.log(req.baseUrl)
    res.send({
        msg:'router get with mid12',
        name:'home'
    })
})

router.get('/user',(req,res)=>{
    res.send({
        msg:'router get without mid12',
        name:'usser'
    })
})

module.exports = router */

/* const express = require('express')
const router = express.Router()

let mw1 = (req,res,next)=>{
    console.log('midware1')
    next()
}

let mw2 = (req,res,next)=>{
    console.log('midware2')
    next()
}

router.get('/home',[mw1,mw2],(req,res)=>{
    console.log(req.baseUrl)
    res.send({
        msg:'get express'
    })
})

router.post('/',mw1,(req,res)=>{
    res.send({
        msg:'post express'
    })
})

module.exports = router */

const express = require('express')
const router = express.Router()

let mw1 = (req,res,next)=>{
    console.log('midware1')
    next()
}

let mw2 = (req,res,next)=>{
    console.log('midware2')
    next()
}

router.get('/home',[mw1,mw2],(req,res)=>{
    console.log(req.baseUrl)
    res.send({
        msg:'router get with mid12',
        name:'home'
    })
})

router.get('/user',(req,res)=>{
    res.send({
        msg:'router get without mid12',
        name:'usser'
    })
})

module.exports = router 